package com.briup.mt.web.controller;
import com.briup.mt.bean.BaseRolePrivilege;
import com.briup.mt.service.IBaseRolePrivilegeService;
import com.briup.mt.utils.Message;
import com.briup.mt.utils.MessageUtil;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.util.List;
@RestController
@RequestMapping("/baseRolePrivilege")
@Validated
public class BaseRolePrivilegeController {
@Autowired
    private IBaseRolePrivilegeService baseRolePrivilegeService;

    @GetMapping("query")
    public Message query(Long id){
        List<BaseRolePrivilege>list=baseRolePrivilegeService.query(id);
        return MessageUtil.success(list);
    }

    @PostMapping("SaveOrUpdate")
    public Message saveOrUpdate(BaseRolePrivilege baseRolePrivilege){
        baseRolePrivilegeService.saveOrUpdate(baseRolePrivilege);
        return MessageUtil.success( "操作成功");
    }

    @DeleteMapping("DeleteById")
    @ApiImplicitParams({
            @ApiImplicitParam(name="id",value = "用户角色编号",required = true,paramType = "query"),
    })
    public Message deleteById( @NotNull Long id){
        baseRolePrivilegeService.deleteById(id);
        return MessageUtil.success( "操作成功");
    }

}
